<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function makeCounter(){
            function counter(){}//counter = {}
            counter.count = 0;
            counter.set = function(v){
                this.count = v;
            }
            counter.decrease  = function(v){
                this.count -= v;
            }
            return counter;
        }
       const c =  makeCounter();//c === counter
       c.set(100);
       console.log(c.count);//100
       c.decrease(20);
       console.log(c.count);//80

    </script>
</body>
</html>